<?php
namespace App\Common\Cla\ClaBase\Traits;

use App\Common as com;

trait Make {

	/**
	 * 创建新对象
	 * @return static 初始化的类
	 */
	public static function make():static {
		$this_class_name = static::class;
		return new $this_class_name( ...func_get_args() );	// func_get_args()返回全部参数的值,类型是数组
	}

	/**
	 * 创建新对象(只初始化一次，后续的初始化参数无效)
	 * @return static 初始化的类
	 */
	public static function makeOfStatic(  ):static {
		$funcGetArgs = func_get_args();
		return com\Lib\StaticPool::getOrNew( static::class, function() use( $funcGetArgs ) {
			return self::make( ...$funcGetArgs );
		} );
	}

}
